﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Presenters;

namespace University.Workshop.WinApp
{
    public partial class EmployeeForm :TemplateForm, IRegistrationEmployeeView
    {
        RegisterPresenter employee;
        public EmployeeForm()
        {
            InitializeComponent();
            employee = new RegisterPresenter(this);
        }

        private void bRegister_Click(object sender, EventArgs e)
        {
            employee.CreateNewEmployee();
        }

        #region IRegistrationEmployeeView Members

        public string CI
        {
            get { return txtCI.Text; }
        }
        public string NameEmployee
        {
            get { return txtName.Text; }
        }
        public string Surname
        {
            get { return txtSurname.Text; }
        }
        public string WorkArea
        {
            get { return cbWorkArea.Text; }
        }
        public string Email
        {
            get { return txtEmail.Text; }
        }
        public string Telephone
        {
            get { return txtTelephone.Text; }
        }
        public string Address
        {
            get { return txtAddress.Text; }
        }
        #endregion

        #region IBaseView Members

        public string MessageWarnings
        {
            set 
            {
                if (string.Equals("Register complete", value))
                {
                    ClearAll();
                }
                MessageBox.Show(value); 
            }
            get { return "never"; }
        }
       
        #endregion

        private void bCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private void ClearAll()
        {
            this.txtAddress.Text = string.Empty;
            this.txtCI.Text = string.Empty;
            this.txtEmail.Text = string.Empty;
            this.txtName.Text = string.Empty;
            this.txtSurname.Text = string.Empty;
            this.txtTelephone.Text = string.Empty;
        }
    }
}
